[SQL] How to SELECT TOP 5 and then the following 5?

Posted by Crays on Stack Overflow See other posts from Stack Overflow or by Crays
Published on 2010-03-20T12:17:27Z Indexed on 2010/03/20 12:21 UTC
Read the original article Hit count: 342

Filed under:
|

Hi guys, as the comments always have it, you can select to show the top 5 comments (which i know how) and if there is more than 5, you can click a link and it will show the following 5 comments. The problem is that i don't know how the code should be for it to show the next 5.

Better idea of what i'm saying Let's say i have 10 comments, i use

SELECT * FROM news ORDER BY ID DESC LIMIT 5

that will show the TOP 5 comments say, the comments with ID 10,9,8,7,6

but what if i want the comments with ID 5,4,3,2,1 ?

© Stack Overflow or respective owner

Related posts about sql

Related posts about select